import com.onlylemi.processing.android.capture.*;

AndroidSensor as;

void setup() {
  size(1500, 750, P3D);
  rectMode(CENTER);
  background(255);
  fill(0, 255, 0);
  translate(width/2, height/2);
  box(400, 200, 100);
  as = new AndroidSensor(0);
  as.start();
}

void draw() {
  float[] values = as.getOrientationSensorValues();
  float z = values[0]-180;
  float y = values[1];
  float x = values[2];
  background(255);  //clear screen.
  fill(0, 255, 0);
  translate(width/2, height/2); 
  rotateX(radians(x));
  rotateY(radians(y));
  rotateZ(radians(z));
  box(400, 200, 100);

  println(values);
}
